package com.kiliter.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName zhangjl
 * @date 2021/6/1 11:28
 * @Version 1.0
 */
@Configuration
public class RabbitMqConfig {

    @Bean
    Queue BirthdayQueue() {
        return new Queue("BirthdayQueue", true);
    }

    @Bean
    DirectExchange BirthdayExchange() {
        return new DirectExchange("BirthdayExchange", true, false);
    }

    @Bean
    Binding bindingExchange() {
        return BindingBuilder.bind(BirthdayQueue()).to(BirthdayExchange()).with("birthday");
    }
}
